/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: ApplicationContext.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/3/21 下午5:02
 * LastModified: 2020/03/21 17:02:21
 */

package com.qolome.knowledge.design.pattern.state.gper;


/**
 * @author Qolome
 * @version V1.0
 * @Description 应用上线
 * @date 2020年 03月21日 17:02:13
 */
public class ApplicationContext {

    public static final UserState STATE_LOGIN = new LoginState();
    public static final UserState STATE_UNLOGIN = new UnLoginState();
    private UserState currentState = STATE_UNLOGIN;


    {
        STATE_LOGIN.setContext(this);
        STATE_UNLOGIN.setContext(this);

    }

    public void setState(UserState userState) {
        this.currentState = userState;
    }

    public UserState geState() {
        return this.currentState;
    }


    public void favorite(){
        this.currentState.favorite();
    }

    public void comment(String comment){
        this.currentState.comment(comment);
    }

}
